<template>
  <div>
    <p>数字和为：{{ sum }}</p>
    <p>父亲可使用资金：{{ parentMoney }}</p>
    <button @click="huo">开火车</button>
    <hr>
    <ChidCon @updateSum="update"></ChidCon>
  </div>
</template>

<script setup>
     import {ref,inject} from 'vue';
     import ChidCon from './ChildCon.vue';

     const sum = ref(0);


     const update = (v)=>{
        sum.value +=v;
     }

     const parentMoney = inject('familyMoney');
     const huo = ()=>{
        parentMoney.value +=8000;
     }
</script>

<style lang="scess" scoped></style>